package com.code.google.ccengel.android.CardsAlpha.model;


public class Card {
	/**
	 * Constructs a new card.
	 * 
	 * @param rank
	 * @param suit
	 */
	public Card(Rank rank, Suit suit) {
		this.cardRank = rank;
		this.cardSuit = suit;
	}

	/**
	 * Constructs a new Euchre Card.
	 * 
	 * @param rank
	 * @param suit
	 */
	public Card(EuchreRank rank, Suit suit) {
		this.cardEuchreRank = rank;
		this.cardSuit = suit;
	}

	/**
	 * Gets the rank (value) of the Card.
	 * 
	 * @return Rank
	 */
	public Rank getRank() {
		return this.cardRank;
	}

	/**
	 * Gets the Euchre Rank (value) of the Card.
	 * 
	 * @return EuchreRank
	 */
	public EuchreRank getEuchreRank() {
		return this.cardEuchreRank;
	}

	/**
	 * Gets the Suit of the Card.
	 * 
	 * @return Suit
	 */
	public Suit getSuit() {
		return this.cardSuit;
	}

	private EuchreRank cardEuchreRank;
	private Rank cardRank;
	private Suit cardSuit;
	
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((cardEuchreRank == null) ? 0 : cardEuchreRank.hashCode());
		result = prime * result
				+ ((cardRank == null) ? 0 : cardRank.hashCode());
		result = prime * result
				+ ((cardSuit == null) ? 0 : cardSuit.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Card other = (Card) obj;
		if (cardEuchreRank == null) {
			if (other.cardEuchreRank != null)
				return false;
		} else if (!cardEuchreRank.equals(other.cardEuchreRank))
			return false;
		if (cardRank == null) {
			if (other.cardRank != null)
				return false;
		} else if (!cardRank.equals(other.cardRank))
			return false;
		if (cardSuit == null) {
			if (other.cardSuit != null)
				return false;
		} else if (!cardSuit.equals(other.cardSuit))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Card [cardEuchreRank=" + cardEuchreRank + ", cardRank="
				+ cardRank + ", cardSuit=" + cardSuit + "]";
	}
}

	